﻿{include file="common/header" /}
<article class="page-container">
	<form action="" method="post" class="form form-horizontal" id="myform">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>WareHouse：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<span class="select-box">
					<select name="warehouse" id="warehouse" class="select valid" style="">
					<option value="1600" {if condition="$data->warehouse eq '1600'"} selected {/if}>Richmond</option>
					<option value="1200" {if condition="$data->warehouse eq '1200'"} selected {/if}>Milpitas</option>
					<option value="1050" {if condition="$data->warehouse eq '1050'"} selected {/if}>Maywood</option>
					<option value="1400" {if condition="$data->warehouse eq '1400'"} selected {/if}>Stockton</option>
				</select>
				</span>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>NickName：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{{$data->nickname}}" placeholder="nickname" id="nickname" name="nickname">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>Address：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{{$data->address}}" placeholder="Address" id="address" name="address">
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>City：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{{$data->city}}" placeholder="City" id="city" name="city">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>Phone：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{{$data->phone}}" placeholder="Phone" id="phone" name="phone">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>Regoin：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{{$data->regoin}}" placeholder="Regoin" id="regoin" name="regoin">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>Start Location：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<span class="select-box">
					<select name="start_location" id="start_location" class="select valid" style="">
                           {{volist name="wareHouse" id="vo"}}
                            <option value="{{$vo->location_code}}" {if condition="$data->start_location eq $vo->location_code"}selected{/if}>{{$vo->name}}</option>
                            {{/volist}}
			    	</select>
				</span>

			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>End Location：</label>
			<div class="formControls col-xs-8 col-sm-9">
					<span class="select-box">
					<select name="end_location"  id="end_location" class="select valid" style="">
					  {{volist name="wareHouse" id="vo"}}
                            <option value="{{$vo->location_code}}" {if condition="$data->end_location eq $vo->location_code"}selected{/if}>{{$vo->name}}</option>
						{{/volist}}
				</select>
				</span>
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>Departure Time：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="time" class="input-text" value="{{$data->departure_time}}" placeholder="Departure Time" id="departure_time" name="departure_time">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>End Time：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="time" class="input-text" value="{{$data->end_time}}" placeholder="Phone" id="end_time" name="end_time">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>Work Hours：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{{$data->work_hours}}" placeholder="Work Hours" id="work_hours" name="work_hours">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red"></span>Notes：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{{$data->notes}}" placeholder="Notes" id="notes" name="notes">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red"></span>Status：</label>
			<div class="formControls col-xs-8 col-sm-9">
					<span class="select-box">
					<select name="status"  id="status" class="select valid" style="">
					<option value="1" {if condition="$data->status eq '1'"} selected {/if}>正常</option>
					<option value="0" {if condition="$data->status eq '0'"} selected {/if}>禁用</option>
				</select>
				</span>
			</div>
		</div>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				<button type="button" class="btn btn-success radius" id="save-btn" name="admin-role-save"><i class="icon-ok"></i> 确定</button>
			</div>
		</div>
		<input type="hidden" class="input-text" value="{{$data->driver_id}}" placeholder="Driver Id" id="driver_id" name="driver_id">
		<input type="hidden" class="input-text" value="{{$data->id}}"  id="id" name="id">
	</form>
</article>
<script>
	$('#save-btn').click(function () {
        $.ajax({
            type: "POST",
            dataType: "json",
            url: "{{:url('/driver/update','',false)}}" ,
            data: $('#myform').serialize(),
            success: function (result) {
                if (result.code == 200) {
                    layer.msg('修改成功!',{icon:1,time:1000},function (index) {
                        parent.getData();
                    });
                }else{
                    layer.msg(result.msg,{icon:1,time:1000});
				}
            },
            error : function() {
                layer.msg('异常!',{icon:1,time:100000000});

            }
        });
    })
</script>
{include file="common/header" /}